<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('修改物料')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-itemInfo-edit" th:object="${itemInfo}">


			<!--<input id="treeId" name="itemTypeId" type="hidden"  />
			<div class="form-group">
				<label class="col-sm-3 control-label ">物料分类：</label>
				<div class="col-sm-8">
					<div class="input-group">
						<input class="form-control" type="text" id="treeName" onclick="selectItemTypeTree()" readonly="true"  >
						<span class="input-group-addon"><i class="fa fa-search"></i></span>
					</div>
				</div>
			</div>-->
            <input id="itemId" name="itemId" th:field="*{itemId}"  type="hidden">
			<div class="form-group">	
				<label class="col-sm-3 control-label">编码：</label>
				<div class="col-sm-8">
					<input id="itemCode" name="itemCode" th:field="*{itemCode}" class="form-control" type="text" disabled="true">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">描述：</label>
				<div class="col-sm-8">
					<input id="itemName" name="itemName" th:field="*{itemName}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">厚度（毫米）：</label>
				<div class="col-sm-8">
					<input id="thickness" name="thickness" th:field="*{thickness}" class="form-control" type="text" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">修改人卡号一</label>
				<div class="col-sm-8">
					<input id="cardNoOne" name="cardNoOne" th:field="*{cardNoOne}"  class="form-control" type="password" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">修改人卡号二</label>
				<div class="col-sm-8">
					<input id="cardNoTwo" name="cardNoTwo" th:field="*{cardNoTwo}"  class="form-control" type="password" required>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/itemInfo";
		$("#form-itemInfo-edit").validate({
			onkeyup: false,
			rules:{
				cardNoOne:{
					minlength: 2,
					maxlength: 20,
					remote: {
						url: ctx + "system/operator/checkOperatorCard",
						type: "post",
						dataType: "json",
						data: {
							"operatorCard" : function() {
								return $.common.trim($("#cardNoOne").val());
							}
						},
						dataFilter: function(data, type) {
							debugger
							if(data === "1"){
								return $.validate.unique("0");
							}else{
								return $.validate.unique("1");
							}
						}
					}
				},
				cardNoTwo:{
					minlength: 2,
					maxlength: 20,
					remote: {
						url: ctx + "system/operator/checkOperatorCard",
						type: "post",
						dataType: "json",
						data: {
							"operatorCard" : function() {
								return $.common.trim($("#cardNoTwo").val());
							}
						},
						dataFilter: function(data, type) {
							if(data === "1"){
								return $.validate.unique("0");
							}else{
								return $.validate.unique("1");
							}
						}
					}
				},
			},
			messages: {
				"cardNoOne": {
					remote: "此卡号未录入，请联系管理员录入!"
				},
				"cardNoTwo": {
					remote: "此卡号未录入，请联系管理员录入!"
				},

			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-itemInfo-edit').serialize());
	        }
	    }

		/*部门管理-新增-选择父部门树*/
		function selectItemTypeTree() {
			debugger
			var options = {
				title: '物料分类选择',
				width: "380",
				url: ctx + "system/itemType" + "/selectItemTypeTree/0",
				callBack: doSubmit
			};
			$.modal.openOptions(options);
		}

		function doSubmit(index, layero){
			var body = layer.getChildFrame('body', index);
			$("#treeId").val(body.find('#treeId').val());
			$("#treeName").val(body.find('#treeName').val());
			layer.close(index);
		}

	</script>
</body>
</html>
